package com.joshjung.hover.interactive
{
    import flash.display.Sprite;
    import flash.events.Event;

    public class CheckPoint extends Sprite
    {
        protected var radius : Number;
        public var passed : Boolean = false;

        public function CheckPoint(x : Number, y : Number, radius : Number)
        {
            super();

            this.radius = radius;
            this.x = x;
            this.y = y;

            addEventListener(Event.ENTER_FRAME, enterFrameHandler);
        }

        public function enterFrameHandler(event : Event) : void
        {
            graphics.clear();

            if (passed)
            {
                graphics.lineStyle(1, 0xEEEEEE);
                graphics.beginFill(0xDDDDDD);
            }
            else
            {
                graphics.lineStyle(1, 0x3344FF);
                graphics.beginFill(0x4455FF);
            }

            graphics.drawCircle(0, 0, radius);

            graphics.endFill();
        }
    }
}
